package org.cying.main.util;

import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import org.cying.main.domain.Student;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * 签到服务方法库
 * @author Cying
 */
public class SignUtils {

    private static Map<Long, Student> DUTY_MAP = new HashMap<>();

    /**
     * 获取当前时间段标志
     * @return 时间标志
     */
    public static String getDuty() {
        Date date1 = DateUtil.parse("2020-07-01");
        Date date2 = DateUtil.parse(DateUtil.today());

        long result = DateUtil.between(date1, date2, DateUnit.DAY);
        long weekType = (result / 7 + 1) % 2;
        System.out.println(weekType);
        return "d" + (DateUtil.thisDayOfWeek() - 1) + Method.getTime().getFlag();
    }

    public static Map<Long, Student> getDutyMap() {
        return DUTY_MAP;
    }

    public static void setDutyMap(Map<Long, Student> dutyMap) {
        DUTY_MAP = dutyMap;
    }

}
